import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:jump_scape/js_ui/js_widget/js_image_view.dart';
import 'package:jump_scape/js_ui/js_widget/js_style.dart';
import 'package:url_launcher/url_launcher.dart';

import '../../js_config.dart';
import '../../js_data/js_event.dart';

class JsAboutActivity extends StatefulWidget {
  static const url = 'about';
  const JsAboutActivity({super.key});

  @override
  State<StatefulWidget> createState() => _JsAboutActivity();
}

class _JsAboutActivity extends State<JsAboutActivity> {
  var isPlaying = false;
  @override
  void initState() {
    super.initState();
    JsEventManager.statPage(page: JsEventName.jsNameAbout);
  }

  @override
  Widget build(BuildContext context) {
    return WillPopScope(
      onWillPop: () => Future.value(false),
      child: Scaffold(
        body: Stack(
          children: [
            jsImage('assets/image/ic_records_bg.png', width: double.infinity, height: double.infinity, fit: BoxFit.cover),
            Padding(
              padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight),
              child: Row(
                children: [
                  InkWell(
                    onTap: () {
                      if (Navigator.canPop(context)) {
                        Navigator.pop(context);
                      }
                    },
                    child: Container(
                      padding: EdgeInsets.fromLTRB(18.r, 15.r, 18.r, 0),
                      child: jsImage('assets/image/ic_finish.png', width: 64.r, height: 64.r),
                    ),
                  ),
                ],
              ),
            ),
            Container(
              width: double.infinity,
              height: double.infinity,
              margin: EdgeInsets.fromLTRB(26.r, ScreenUtil().statusBarHeight + 40.r, 26.r, 0),
              clipBehavior: Clip.antiAlias,
              decoration: jsShapeRoundT(radius: 200.r, color: Colors.white),
              child: SingleChildScrollView(
                child: Column(
                  children: [
                    jsImage('assets/image/ic_about.png', width: 70.r, fit: BoxFit.fitWidth, padding: EdgeInsets.only(top: 28.r)),
                    Container(
                      margin: EdgeInsets.only(top: 34.r, bottom: 9.r),
                      decoration: jsShapeRound(radius: 14.r, borderColor: Colors.black, borderWidth: 2.r),
                      child: Container(
                        width: 81.r,
                        height: 81.r,
                        clipBehavior: Clip.antiAlias,
                        decoration: jsShapeRound(radius: 14.r),
                        child: jsImage('assets/image/ic_logo.png'),
                      ),
                    ),
                    Container(
                      height: 38.r,
                      alignment: Alignment.center,
                      child: Text(JsApp.appName, style: jsTextStyle(font: JsTextFont.PoetsenOne, fontColor: Colors.black, fontSize: 18.r)),
                    ),
                    Container(
                      height: 45.r,
                      padding: EdgeInsets.fromLTRB(13.r, 0, 20.r, 0),
                      margin: EdgeInsets.fromLTRB(18.r, 30.r, 18.r, 0),
                      decoration: jsShapeRound(radius: 10.r, color: Color(0xFFF9F9F9)),
                      child: Row(
                        children: [
                          Text("Version", style: jsTextStyle(font: JsTextFont.October_Devanagari_Regular, fontColor: Colors.black, fontSize: 16.r)),
                          Spacer(),
                          Text(JsApp.versionName, style: jsTextStyle(font: JsTextFont.October_Devanagari_Regular, fontColor: Colors.black, fontSize: 16.r)),
                        ],
                      ),
                    ),
                    InkWell(
                      child: Container(
                        width: double.infinity,
                        height: 45.r,
                        padding: EdgeInsets.fromLTRB(13.r, 0, 13.r, 0),
                        margin: EdgeInsets.fromLTRB(18.r, 30.r, 18.r, 0),
                        alignment: Alignment.centerLeft,
                        decoration: jsShapeRound(radius: 10.r, color: Color(0xFFF9F9F9)),
                        child: Text("Terms And Conditons", style: jsTextStyle(font: JsTextFont.October_Devanagari_Regular, fontColor: Colors.black, fontSize: 16.r)),
                      ),
                      onTap: () {
                        launchUrl(Uri.parse(JsApp.jsTOS));
                      },
                    ),
                    InkWell(
                      child: Container(
                        width: double.infinity,
                        height: 45.r,
                        padding: EdgeInsets.fromLTRB(13.r, 0, 13.r, 0),
                        margin: EdgeInsets.fromLTRB(18.r, 30.r, 18.r, 0),
                        alignment: Alignment.centerLeft,
                        decoration: jsShapeRound(radius: 10.r, color: Color(0xFFF9F9F9)),
                        child: Text("Privacy Policy", style: jsTextStyle(font: JsTextFont.October_Devanagari_Regular, fontColor: Colors.black, fontSize: 16.r)),
                      ),
                      onTap: () {
                        launchUrl(Uri.parse(JsApp.jsPP));
                      },
                    ),
                    SizedBox(height: 224.r),
                  ],
                ),
              ),
            ),
            Align(
              alignment: Alignment.bottomCenter,
              child: IgnorePointer(
                child: jsImage('assets/image/ic_home_bg_bottom.png', width: double.infinity, fit: BoxFit.fitWidth),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
